package nxt.RoboRPG;


import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class ControlApp extends JFrame implements ActionListener, MouseListener, MouseMotionListener, KeyListener{

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	GraphicsDevice device;
	
    boolean isFullScreen = false;
    
    JButton exit = new JButton ("Exit");
    
    JButton fow = new JButton ("F");
    JButton backw = new JButton ("B");
    JButton leftw = new JButton ("L");
    JButton rightw = new JButton ("R");
    JButton stop = new JButton ("X");
     
    JLabel titel = new JLabel ("R o b o   R P G");
    
    public ControlApp(GraphicsDevice device) {
    	
        super(device.getDefaultConfiguration());
        this.device = device;
        
        setTitle("RoboRPG");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        
        titel.setFont(new Font("Impact",1,60));
        
        exit.addActionListener(this);
        exit.setActionCommand("exit");
        
        fow.addActionListener(this);
        fow.setActionCommand("fow");
        backw.addActionListener(this);
        backw.setActionCommand("backw");
        leftw.addActionListener(this);
        leftw.setActionCommand("leftw");
        backw.addActionListener(this);
        backw.setActionCommand("backw");
        stop.addActionListener(this);
        stop.setActionCommand("stop");
        
    }

    public void actionPerformed(ActionEvent e) {
    	String cmd = e.getActionCommand();
    	
    	if(cmd.equals("exit")){
    		System.exit(0);
    	}
    	
    	if(cmd.equals("fow")){
    		
    	}
    	
    	if(cmd.equals("backw")){
    		
    	}
    	
    	if(cmd.equals("leftw")){
    		
    	}
    	
    	if(cmd.equals("rightw")){
    		
    	}
    	
    	if(cmd.equals("stop")){
    		
    	}
    }
    
    
	public void mouseClicked(MouseEvent e) {
		
	}

	public void mouseEntered(MouseEvent e) {
		
	}

	public void mouseExited(MouseEvent e) {
		
	}

	public void mousePressed(MouseEvent e) {
		
	}

	public void mouseReleased(MouseEvent e) {
		
	}
	
	public void mouseDragged(MouseEvent e) {
		
	}

	public void mouseMoved(MouseEvent e) {
		
	}
	
	
	public void keyPressed(KeyEvent e) {
		if (e.getKeyCode() == KeyEvent.VK_ESCAPE){
			System.out.println("exit");
			System.exit(0);
		}
	}

	public void keyReleased(KeyEvent e) {
		
	}
	public void keyTyped(KeyEvent e) {

	}

	
    public void begin() {
        isFullScreen = device.isFullScreenSupported();
        setUndecorated(isFullScreen);
        setResizable(!isFullScreen);
        
        setLayout(null);
		
		exit.setBounds(10,10,100,50);	//(x,y,breite,hoehe)
		add(exit);
		titel.setBounds(500,10,500,100);
		add(titel);
		
		fow.setBounds(600,300,100,200);
		add(fow);
		backw.setBounds(600,600,100,200);
		add(backw);
		leftw.setBounds(400,500,200,100);
		add(leftw);
		rightw.setBounds(700,500,200,100);
		add(rightw);
		stop.setBounds(600,500,100,100);
		add(stop);
        
        if (isFullScreen) {
            // Full-screen mode
            device.setFullScreenWindow(this);
            validate();
        } else {
            // Windowed mode
            pack();
            setVisible(true);
        }   
    }

    public static void main(String[] args) {
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice devices = env.getDefaultScreenDevice();
        ControlApp test = new ControlApp(devices);
        test.begin();
    }
}
